// 菜单管理模块的接口
import request from "@/utils/request";
import { DataPermissionResData, MenuButtonDataObj } from "./types";

enum API {
    // 获取全部菜单与按钮接口
    GETALLMENUBUTTIN_URL = '/admin/acl/permission',
    // 新增菜单接口
    ADDMENU_URL = '/admin/acl/permission/save',
    // 修改菜单接口
    UPDATEMENU_URL = '/admin/acl/permission/update',
    // 删除菜单接口
    DELETEMENU_URL = '/admin/acl/permission/remove/',
}

// 获取全部的菜单与按钮
export const reqAllMemuButton = (): Promise<DataPermissionResData> => request({
    url: API.GETALLMENUBUTTIN_URL,
    method: 'GET'
})
// 新增菜单
export const reqAddMenu = (data: MenuButtonDataObj): any => request({
    url: API.ADDMENU_URL,
    method: 'POST',
    data
});
// 修改菜单
export const reqEditMenu = (data: MenuButtonDataObj): any => request({
    url: API.UPDATEMENU_URL,
    method: 'PUT',
    data
});
// 删除菜单
export const reqDeleteMenu = (menuId: number): any => request({
    url: API.DELETEMENU_URL + menuId,
    method: 'DELETE'
});